struct PixelData
{
  float4 Pos : POSITION0;
  float3 NormWorld : TEXCOORD1;
  float2 TexCoord : TEXCOORD0;
  float3 HalfLight0 : TEXCOORD2;
  float3 HalfLight1 : TEXCOORD3;
  float3 HalfLight2 : TEXCOORD4;
};


float3 gLightDir0;
float3 gLightDir1;
float3 gLightDir2;


float gSpecularPower;
float gSpecularAmount;
float4 gSpecularColor;

sampler2D diffuseSampler;

float ambientAmount = 0.1;

float4 main(PixelData i) : COLOR0
{
   float3 rgb = tex2D(diffuseSampler, i.TexCoord).rgb;
   
   float diffuse = (saturate( dot(i.NormWorld, -gLightDir0))
		+ saturate( dot(i.NormWorld, -gLightDir1)) 
		+ saturate( dot(i.NormWorld, -gLightDir2))) *0.5 ;

   float4 specular = ((pow(saturate(dot(i.HalfLight0, i.NormWorld)), gSpecularPower) 
		+ pow(saturate(dot(i.HalfLight1, i.NormWorld)), gSpecularPower) 
		+ pow(saturate(dot(i.HalfLight2, i.NormWorld)), gSpecularPower) )
		* gSpecularAmount) * gSpecularColor;

 //  return float4( (diffuse+ambientAmount) * rgb * 0 + specular.rgb, 1);
   return float4((diffuse+ambientAmount) * rgb + specular.rgb, 1);
};